<?php
/**
 * Created by PhpStorm.
 * User: fengsenhua
 * Date: 2019/2/12
 * Time: 12:09
 */

namespace app\api\model;


class User extends BaseModel
{
    public function address(){
        //一个用户有多个收获地址
//        return $this->hasMany('UserAddress','user_id','id');
        return $this->hasOne('UserAddress','user_id','id');

    }
    public static function getByOpenID($openid){
        $user=self::where('openid','=',$openid)->find();
        return $user;
    }


}